var tblScore;
$(function () {
    tblScore = $('#tbl-score').DataTable(buildlScoreOptions());
    trCssEvent(tblScore);
    // $("#btn-search-schedule").click(scheduleSearch);
});

function buildlScoreOptions() {
    var options = {
        "searching": false,
        "ordering": true,
        "processing": true,
        "scrollX": true,
        "language": {
            "url": plugPath + 'DataTables/chinese.json'
        },
        "serverSide": true,
        "ajax": {
            "url": basePath + "teacher/getScorePageData",
            "type": 'POST',
            data: function (params) {
                params['teacherId'] = $("#teacherId").val();
                params['childId'] = $("#childId").val();
                params['scheduleId'] = $("#courseId").val();
            }
        },

        "columns": [{
            "data": "name"
        }, {
            "data": "score"
        }, {
            "data": "memo"
        }, {
            "data": "createTime"
        }],
        "dom": "<'row'<'col-xs-12't>><'row'<'col-xs-2 lstyle'l><'col-xs-3'i><'col-xs-6  fright'p>>"

    };
    return options;
}


// function showProjectName(scheduleId) {
//     var childId = $("#childId").val();
//     console.log("childId" + childId + "scheduleId" + scheduleId);
//     var date = {
//         scheduleId: scheduleId,
//         childId: childId,
//     };
//     searchProjects(date);
// }
//
// function allProjectesSearch(childId) {
//     var teacherId = $("#teacherId").val();
//     var childId = $("#childId").val();
//     console.log("childId");
//     var date = {
//         childId: childId,
//         teacherId: teacherId
//     };
//     searchProjects(date);
// }
//
//
// // //查询搜索
// function scheduleSearch() {
//     $("#btn-search-schedule").attr("disabled", "disabled");
//     tblSchedule.ajax.reload(function () {
//         $("#btn-search-schedule").removeAttr("disabled");
//     });
// }
//
// //查询课程名字
// function searchProjects(date) {
//     console.log(date);
//     $.ajax({
//         url: basePath + "teacher/getProjectName",
//         type: "post",
//         data: date,
//         success: function (data) {
//             var $msg = ' <div class="box box-solid box-primary"> <div class="box-body  no-padding"> <table class="table table-hover text-center" id="tbl-project" cellspacing="0" width="100%"> <tr> <th>课程类别</th> <th>项目名字</th> <th>课程时间</th><th>操作</th> </tr>';
//             var cont;
//             if (data.ProjectName == "") {
//                 cont = "暂时没有课程项目名字";
//             } else {
//                 cont = data.ProjectName;
//                 for (x in cont) {
//                     var courseName = cont[x].courseName;
//                     var time = cont[x].time;
//                     var project = cont[x].project;
//                     var id = cont[x].id;
//                     var projects = '<tr><td>' + courseName + '</td><td>' + project + '</td><td>' + time + '</td><td><button type="submit" class="btn btn-primary" id="btn-search-schedule">  查看题目 </button><button type="submit" class="btn btn-primary" onclick="searchScore('+id+');" >  查看成绩 </button></td></tr>';
//                     $msg = $msg + projects;
//                 }
//             }
//             console.log(data);
//             $("#schedule_content").empty();
//             $msg = $msg+  '</table> </div> </div>)';
//             $("#schedule_content").append($msg);
//         }
//
//     });
// }
//
// function searchScore(courseId) {
//     alert(courseId);
// }